<?php include("src/updateContract_cs.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href='css/coolMessage.css' type='text/css' rel='stylesheet' media='screen' />
<title>Actualizar Contrato :: ASSC</title>
<link rel="stylesheet" type="text/css" media="all" href="includes/calendario/calendar-system.css" title="system" />
<script type="text/javascript" src="includes/calendario/calendar.js"></script>
<script type="text/javascript" src="includes/calendario/lang/calendar-es.js"></script>
<script type="text/javascript" src="includes/calendario/calendar-setup.js"></script>
<script language="javaScript" type="text/javascript" src="js/jquery.js"></script>
<script language="javaScript" type="text/javascript" src="js/jquery.simplemodal.js"></script>
<script language="javaScript" type="text/javascript" src="js/coolMessage.js"></script>
<script language="javascript" type="text/javascript">
	
	var displayRow = '';
	if (navigator.appName == "Netscape")
		displayRow = 'table-row';
	else if (navigator.appName.indexOf("Explorer") != -1) 
		displayRow = 'block';
	

	
	function showMessage(show_msg){
		switch(show_msg){
			case 1://error
				coolMessage('error',"<?php echo $_SESSION["msg_cool"];?>");
			break;
			
			case 2://alert
				coolMessage('alert',"<?php echo $_SESSION["msg_cool"];?>");
			break;
			
			case 3://information
				coolMessage('information',"<?php echo $_SESSION["msg_cool"];?>");
			break;
			
			default:
				
			break;
		}
		return false;
	}
	
	function validate(){
		var msg    = '';

		var cont_type   		= document.getElementById("cont_type").value;
		var cont_sal_periodo   		= document.getElementById("cont_sal_periodo").value;
		var cont_sal_value    		= document.getElementById("cont_sal_value").value;
		var cont_cargo 		= document.getElementById("cont_cargo").value;
		var cont_day_in     		= document.getElementById("cont_day_in").value;
		
		if(cont_type == '') 
			msg='- Por favor entre e tipo de contrato. <br />';
			
		if(cont_sal_periodo == '') 
			msg='- Por favor entre periodo de pago nomina. <br />';
			
		if(cont_sal_value == '') 
			msg= msg+'- Por favor entre valor del salario. <br />';
			
		if(cont_cargo == '') 
			msg= msg+'- Por favor entre cargo. <br />';	
		
		if(cont_day_in == '') 
			msg= msg+'- Por favor entre dia de ingreso. <br />';	
		
		if(msg==''){
			document.getElementById('form').submit();
			return true;
		}
		else{
			alert(msg);
			return false;
		}		
	}
	

	
	function onlyNumbers(e)
	{
	   var key;
	   if(window.event)
		  key = window.event.keyCode;   //IE
	   else
		  key = e.which;                //firefox
	   if (!( (key >= 48 && key <= 57) || key ==8 || key ==9 || key ==0 || key ==46 ))
		  return false;
	   else
		  return true;
	}	
	
	

</script>
</head>
<body onload="javascript: showMessage(<?php echo $show_msg;?>)">
<?php $item_select = 13; include("menu.php");?><br />
    <form name="form" id="form" method="post" action="" enctype="multipart/form-data">
    <input type="hidden" name="edit" id="edit" value="1"/>
    <input type="hidden" name="cont_code" id="cont_code" value="<?php echo $cont_code;?>" />
    <div class="content_grv">
    	<table width="80%" align="center" class="shadow">
        	<tr>
            	<td class="title">Editar Contrato</td>
            </tr>
            <tr>
            	<td>
                	<table class="tbl_form" align="center">
                          <tr>
                            <td align="right"><span class="lbl_gray">Compania:</span></td>
                            <td>&nbsp;</td>
                            <td>
                                <?php echo $data->hdvc_name; ?>
                            </td>
                        </tr>

                        <tr>
                            <td align="right"><span class="lbl_gray">Empleado:</span></td>
                            <td>&nbsp;</td>
                            <td><?php echo $data->hdv_name; ?> <?php echo $data->hdv_lastname; ?>
                            </td>
                        </tr>
                        <tr>
                        	<td width="35%" align="right"><span class="lbl_gray">Tipo:</span></td>
                            <td width="1%">&nbsp;</td>
                            <td><select name="cont_type" id="cont_type" class="text_grv">
                                    <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                    <option value="Independiente"<?php if($data->cont_type == "Independiente") echo 'selected="selected"'; ?>>Independiente</option>
                                    <option value="Indefinido"<?php if($data->cont_type == "Indefinido") echo 'selected="selected"'; ?>>Indefinido</option>
                            	    <option value="Temporal"<?php if($data->cont_type == "Temporal") echo 'selected="selected"'; ?>>Temporal</option>
                                </select></td>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Valor Contrato:</span></td>
                            <td>&nbsp;</td>
                            <td><input type="text" name="cont_value" id="cont_value" class="text_grv" size="21" maxlength="20" value="<?php echo $data->cont_value;?>" /></td>
                        </tr>
                                          
                        <tr>
                        	<td align="right"><span class="lbl_gray">Periodo Salario:</span></td>
                            <td>&nbsp;</td>
                            <td><select name="cont_sal_periodo" id="cont_sal_periodo" class="text_grv">
                                    <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                    <option value="Quincenal"<?php if($data->cont_sal_periodo == "Quincenal") echo 'selected="selected"'; ?>>Quincenal</option>
                                    <option value="Mensual"<?php if($data->cont_sal_periodo == "Mensual") echo 'selected="selected"'; ?>>Mensual</option>
                            	</select></td>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Valor Salario:</span></td>
                            <td>&nbsp;</td>
                            <td><input type="text" name="cont_sal_value" id="cont_sal_value" class="text_grv" size="21" maxlength="20" value="<?php echo $data->cont_sal_value;?>" /></td>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Cargo:</span></td>
                            <td>&nbsp;</td>
                            <td><input type="text" name="cont_cargo" id="cont_cargo" class="text_grv" size="21" maxlength="20" value="<?php echo $data->cont_cargo;?>" /></td>
                        </tr>
                        <tr>
                                        <td align="right" valign="top"><span class="lbl_gray">Fecha de Ingreso:</span></td>
                                        <td>&nbsp;</td>
                                        <td><input name="cont_day_in" type="text" style="width:100px" readonly="readonly" id="cont_day_in" maxlength="45" class="text_grv"
				value="<?php if(isset($data)) echo cambiarFormatoFecha($data->cont_day_in,1)?>"/> 
			    <input name="imagea" type="image" id="calendar1" src="images/mostrar_calendario.png" align="absmiddle" width="18" height="16"/></td><script type="text/javascript">
						Calendar.setup({
						inputField : "cont_day_in",							
						ifFormat : "%d/%m/%Y",
						showsTime : false,
						button : "calendar1", 
						step : 1
						});
				</script>
                        </tr>
                        <tr>
                                        <td align="right" valign="top"><span class="lbl_gray">Fecha de Salida:</span></td>
                                        <td>&nbsp;</td>
                                        <td><input name="cont_day_out" type="text" style="width:100px" readonly="readonly" id="cont_day_out" maxlength="45" class="text_grv"
				value="<?php if(isset($data)) echo cambiarFormatoFecha($data->cont_day_out,1)?>"/> 
			    <input name="imagea" type="image" id="calendar2" src="images/mostrar_calendario.png" align="absmiddle" width="18" height="16"/></td><script type="text/javascript">
						Calendar.setup({
						inputField : "cont_day_out",							
						ifFormat : "%d/%m/%Y",
						showsTime : false,
						button : "calendar2", 
						step : 1
						});
				</script>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Funeral:</span></td>
                            <td>&nbsp;</td>
                            <td> $ <input type="text" name="cont_funeral" id="cont_funeral" class="text_grv" size="21" maxlength="20" value="<?php echo $data->cont_funeral;?>" /></td>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Administracion:</span></td>
                            <td>&nbsp;</td>
                            <td> $ <input type="text" name="cont_admin" id="cont_admin" class="text_grv" size="21" maxlength="20" value="<?php echo $data->cont_admin;?>" /></td>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Aporte Mutual:</span></td>
                            <td>&nbsp;</td>
                            <td> $ <input type="text" name="cont_aporte_mutual" id="cont_aporte_mutual" class="text_grv" size="21" maxlength="20" value="<?php echo $data->cont_aporte_mutual;?>" /></td>
                        </tr>
                        <?php if ($data->hdvc_code == 1) {?>
                        <tr>
                            <td align="right"><span class="lbl_gray">EPS:</span></td>
                            <td>&nbsp;</td>
                            <td>
                                <select name="eps_code" id="eps_code" class="text_grv">
                                <?php 
                                for($i=0; $i<count($eps);$i++) 
                                {
                                $select = '';
                                if($data->eps_code==$eps[$i]->eps_code) 
                                    $select = 'selected="selected"';
                              	?>
                                
                                <option value="<?php echo $eps[$i]->eps_code;?>" <?php echo $select;?>><?php echo $eps[$i]->eps_name;?></option>
                                <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">ARP:</span></td>
                            <td>&nbsp;</td>
                            <td>
                                <select name="arp_code" id="arp_code" class="text_grv">
                                <?php 
                                for($i=0; $i<count($arp);$i++) 
                                {
                                $select = '';
                                if($data->arp_code==$arp[$i]->arp_code) 
                                    $select = 'selected="selected"';
                              	?>
                                
                                <option value="<?php echo $arp[$i]->arp_code;?>" <?php echo $select;?>><?php echo $arp[$i]->arp_name;?></option>
                                <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">AFP:</span></td>
                            <td>&nbsp;</td>
                            <td>
                                <select name="afp_code" id="afp_code" class="text_grv">
                                <?php 
                                for($i=0; $i<count($afp);$i++) 
                                {
                                $select = '';
                                if($data->afp_code==$afp[$i]->afp_code) 
                                    $select = 'selected="selected"';
                              	?>
                                
                                <option value="<?php echo $afp[$i]->afp_code;?>" <?php echo $select;?>><?php echo $afp[$i]->afp_name;?></option>
                                <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Nombre Poliza:</span></td>
                            <td>&nbsp;</td>
                            <td><input type="text" name="cont_name_poliza" id="cont_name_poliza" class="text_grv" size="21" maxlength="20" value="<?php echo $data->cont_name_poliza;?>" /></td>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Valor Poliza:</span></td>
                            <td>&nbsp;</td>
                            <td> $ <input type="text" name="cont_value_poliza" id="cont_value_poliza" class="text_grv" size="21" maxlength="20" value="<?php echo $data->cont_value_poliza;?>" /></td>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Nombre Seguro Vida:</span></td>
                            <td>&nbsp;</td>
                            <td><input type="text" name="cont_name_seguro_vida" id="cont_name_seguro_vida" class="text_grv" size="21" maxlength="20" value="<?php echo $data->cont_name_seguro_vida;?>" /></td>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Valor Seguro Vida:</span></td>
                            <td>&nbsp;</td>
                            <td> $ <input type="text" name="cont_value_seguro_vida" id="cont_value_seguro_vida" class="text_grv" size="21" maxlength="20" value="<?php echo $data->cont_value_seguro_vida;?>" /></td>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Nombre Otros:</span></td>
                            <td>&nbsp;</td>
                            <td><input type="text" name="cont_name_otros" id="cont_name_otros" class="text_grv" size="21" maxlength="20" value="<?php echo $data->cont_name_otros;?>" /></td>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Valor Otros:</span></td>
                            <td>&nbsp;</td>
                            <td> $ <input type="text" name="cont_value_otros" id="cont_value_otros" class="text_grv" size="21" maxlength="20" value="<?php echo $data->cont_value_otros;?>" /></td>
                        </tr>
                        <?php  } ?>
                        <tr>
                            <td align="right"><span class="lbl_gray">Asesor:</span></td>
                            <td>&nbsp;</td>
                            <td>
                                <select name="ase_code" id="ase_code" class="text_grv">
                                <?php 
                                for($i=0; $i<count($asesor);$i++) 
                                {
                                $select = '';
                                if($data->ase_code==$asesor[$i]->ase_code) 
                                    $select = 'selected="selected"';
                              	?>
                                
                                <option value="<?php echo $asesor[$i]->ase_code;?>" <?php echo $select;?>><?php echo $asesor[$i]->ase_name;?></option>
                                <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">Caja Compensacion:</span></td>
                            <td>&nbsp;</td>
                            <td>
                                <select name="para_code" id="para_code" class="text_grv">
                                <?php 
                                for($i=0; $i<count($parafiscal);$i++) 
                                {
                                $select = '';
                                if($data->para_code==$parafiscal[$i]->para_code) 
                                    $select = 'selected="selected"';
                              	?>
                                
                                <option value="<?php echo $parafiscal[$i]->para_code;?>" <?php echo $select;?>><?php echo $parafiscal[$i]->para_name;?></option>
                                <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" valign="top"><span class="lbl_gray">Descripcion:</span></td>
                            <td>&nbsp;</td>
                            <td><textarea name="cont_description" id="cont_description" class="text_grv" cols="40" rows="7"><?php echo $data->cont_description;?></textarea></td>
                        </tr>
                        <tr>
                  		<tr>
                        	<td colspan="3" align="center">&nbsp;</td>
                        </tr>
                        <tr>
                        	<td colspan="3" align="center">
                            <input type="button" class="button_grv" value="Save" onclick="javascript: return validate();" />
                            <input type="button" class="button_grv" value="Cancel" onClick="javascript:window.history.back(-1);" /></td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
</form>    
</body>
</html>
<?php include('divscoolmessage.php');?>